package com.wolf.etl.core.dialect;

import com.wolf.etl.model.EtlTableModel;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author sdyang
 * @date 2019/11/5 15:44
 **/
@Service("H2Dialect")
public class H2Dialect extends AbstractDialect {

    @Override
    public String buildPaginationSql(String originalSql, int offset, int limit) {
        String sql = originalSql + " %s limit %s ";
        if (offset > 0) {
            sql += (" offset %s ");
        }
        return String.format(sql, originalSql, limit, offset);
    }

    @Override
    public String buildInsertSelect(EtlTableModel table, String targerTableName, Map<String, String> fields) {
        return null;
    }
}
